﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class PetStore
    {
        宠物寄存
        public void ConsignCat(Cat c) 
        {
            c.Eat();
            c.Sleep();
            c.Walk();
            c.Cry();
        }

        public void ConsignTiger(Tiger t)
        {
            t.Eat();
            t.Sleep();
            t.Walk();
            t.Cry();
        }

        public void ConsignEagle(Eagle e)
        {
            e.Eat();
            e.Sleep();
            e.Walk();
            e.Cry();
        }

        public void ConsignSwallow(Swallow s)
        {
            s.Eat();
            s.Sleep();
            s.Walk();
            s.Cry();
        }

        //优化代码
        public void ConsignAnimal(Animal a)//运行时多态，之前在重载，其实也是多态，不过那叫做编译时多态。
        {
            a.Eat();
            a.Sleep();
            a.Walk();
            a.Cry();//到底会怎么执行呢？
        }
    }
}
